<?php include "../db/db_connect.php"; ?>


<?php
    $email = $_GET["email"];
	$method = $_GET["method"];
	
	$valid_user = "<img src=\"images/ok.png\" />";
	$invalid_user = "<img src=\"images/nok.png\" />";
	
	
	if ($email == "") {
	    echo "";
	}
	else {
		if (!preg_match('/@jdsu\.com$/', $email)) {
			echo $invalid_user;			
		}
		else {
	        $qry = "select user_name from user where user_name=\"{$email}\"";
	        $ds  = mysql_query($qry, $con);
	        $user_number = mysql_num_rows($ds);
	        if ($method == "forget") {
	        	if ($user_number == 0) {
	        		echo $invalid_user;
	        	}
	        	else {
	        		echo $valid_user;
	        	}
	        }
	        if ($method == "register") {
	        	if ($user_number == 0) {
	        		echo $valid_user;
	        	}
	        	else {
	        		echo $invalid_user;
	        	}
	        }
		}
	}
?>
				   
<?php include "../db/db_close.php"; ?>